package Journal;
import java.util.ArrayList;




public class JournalList extends ArrayList{
	
	ArrayList<Journal> journals;
	
	public JournalList(){
		
		journals = new ArrayList<Journal>();
	}
	
	public void addJournal(Journal journal){
		journals.add(journal);
	}
	
	public Journal getJournal(int patientID){
		for(int i = 0; i < journals.size(); i++){
			if(journals.get(i).getPatientID()==patientID){
				return journals.get(i);
			}
		}
		return null;
	}
	public boolean removeJournal(int patientID){

		for(int i = 0; i < journals.size(); i++){
			if(journals.get(i).getPatientID()==patientID){
				journals.remove(i);
				return true;
			}
		}
		
		return false;
	}
	public boolean editJournal(String doc, String nurse, String text, int patientID){
		for(int i = 0; i < journals.size(); i++){
			Journal tempJ = journals.get(i);
			if(tempJ.getPatientID()==patientID){
				
				//måste byta ut i tempJ i listan på något sätt
				tempJ.setDoctor(doc);
				tempJ.setNurse(nurse);
				tempJ.setContent(text);
				tempJ.setContent(text);
				
				return true;
			}
		}
		
		return false;
	}
}